from socket import socket
from sys import path as sp
from threading import Thread
from board import init
# import pygame
# from pygame . locals import *

def sendfile():
    sk = socket()
    sk.connect(('127.0.0.1',2300))
    # print('w=',sk.recv(1024))
    # print('h=',sk.recv(1024))
    
    t = Thread(target=init,args=(
        int(str(sk.recv(1024),encoding='utf-8')),
        int(str(sk.recv(1024),encoding='utf-8'))
    ))
    t.setDaemon(1)
    t.start()
    
    # k = open(sp[0]+'\\file.txt')
    while True:
        sk.send(bytes(input(),encoding='utf-8'))
        
if __name__ == '__main__' :
    sendfile()